import 'package:woniutaofang/components/ui/shimmer.dart';
import 'package:woniutaofang/utils/themcolor.dart';
import 'package:woniutaofang/utils/utils.dart';
import 'package:woniutaofang/utils/theme_utils.dart';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ShimmerView extends StatelessWidget {
  ShimmerView({Key key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: <Widget>[
        Shimmer.fromColors(
          baseColor: context.isDark ? Colours.dark_text_gray : Colors.grey[300],
          highlightColor: context.isDark ? Colors.grey[500] : Colors.grey[100],
          child: Column(
            children: <Widget>[
              Container(
                margin: EdgeInsets.all(ScreenUtil().setWidth(20)),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(12.0),
                  color: context.isDark ? Colours.dark_text_gray : Colors.white,
                ),
                height: ScreenUtil().setHeight(320),
                width: Utils.width,
              ),
            ],
          ),
        ),
        ListView.builder(
          shrinkWrap: true,
          physics: NeverScrollableScrollPhysics(),
          itemBuilder: (BuildContext context, int index) {
            return Shimmer.fromColors(
              baseColor:
                  context.isDark ? Colours.dark_text_gray : Colors.grey[300],
              highlightColor:
                  context.isDark ? Colors.grey[500] : Colors.grey[100],
              child: Column(
                children: <Widget>[
                  Padding(
                    padding: EdgeInsets.all(5),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        Container(
                          height: ScreenUtil().setHeight(36),
                          width: Utils.width,
                          color: Colors.white,
                        ),
                        SizedBox(height: ScreenUtil().setHeight(10)),
                        Container(
                          padding: EdgeInsets.all(12.0),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: <Widget>[
                              Row(
                                children: <Widget>[
                                  Column(
                                    crossAxisAlignment:
                                        CrossAxisAlignment.start,
                                    children: [
                                      Container(
                                        width: ScreenUtil().setWidth(360),
                                        height: ScreenUtil().setHeight(34),
                                        color: Colors.white,
                                      ),
                                      SizedBox(
                                        height: ScreenUtil().setHeight(16),
                                      ),
                                      Container(
                                        height: ScreenUtil().setHeight(34),
                                        width: ScreenUtil().setWidth(260),
                                        color: Colors.white,
                                      ),
                                      SizedBox(
                                        height: ScreenUtil().setHeight(16),
                                      ),
                                      Container(
                                        height: ScreenUtil().setHeight(34),
                                        width: ScreenUtil().setWidth(200),
                                        color: Colors.white,
                                      )
                                    ],
                                  )
                                ],
                                mainAxisSize: MainAxisSize.min,
                              ),
                              Container(
                                height: ScreenUtil().setHeight(150),
                                width: ScreenUtil().setWidth(250),
                                decoration: BoxDecoration(
                                  borderRadius: BorderRadius.circular(8.0),
                                  color: Colors.white,
                                ),
                              )
                            ],
                          ),
                        ),
                        SizedBox(height: ScreenUtil().setHeight(10)),
                      ],
                    ),
                  ),
                ],
              ),
            );
          },
          itemCount: 3,
        )
      ],
    );
  }
}
